11www
-- 循环22滚动背景
1122
local ke32rnel = {}

kernel.category = "filter"
kernel.name = "roll"
kernel.isTimeDependent = true

kernel.vertexData = {
	{
		name = "speed",
		default = 0.1,
		min = 0,
		max = 1,
		index = 0, -- This corresponds to "CoronaVertexUserData.x"
	},
	{
		name = "offset",
		default = 0,
		index = 1, -- This corresponds to "CoronaVertexUserData.x"
	},
	{
		name = "time",
		default = -1,
		index = 2, -- This corresponds to "CoronaVertexUserData.x"
	},
	{
		name = "timeOffset",
		default = 0,
		index = 3,
	},
}

kernel.fragment = [[
	P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
	{
		P_DEFAULT float time;
		if (CoronaVertexUserData.z==-1.0)
		{
			time = CoronaTotalTime + CoronaVertexUserData.w;
		}
		else
		{
			time = CoronaVertexUserData.z;
		}
		P_DEFAULT vec2 uv = vec2(texCoord.x, mod(texCoord.y-time*CoronaVertexUserData.x+CoronaVertexUserData.y,1.0));
		P_DEFAULT vec4 texColor = texture2D( CoronaSampler0, uv);
		return CoronaColorScale(texColor);
	}
]]

if not globalGroup.shaderRecoder[kernel.name] then
	graphics.defineEffect(kernel)
	globalGroup.shaderRecoder[kernel.name] = true
end